package com.nucarf.yc.app

import com.nucarf.yc.utils.KafkaUtil
import org.apache.flink.api.common.serialization.SimpleStringSchema
import org.apache.flink.streaming.api.TimeCharacteristic
import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment}
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
import org.apache.flink.streaming.api.scala._


object Recharge_Kafka {

  def main(args: Array[String]): Unit = {


    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment

    var dml_name: String = ""

    /* 设置并行度 */
    env.setParallelism(1)

    /* 设置时间语义 */
    env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)

    val inputStream: DataStream[String] =
      env.addSource( new FlinkKafkaConsumer[String](
        KafkaUtil.RECHARGE_TEST,
        new SimpleStringSchema(),
        KafkaUtil.kafkaConsumerProperties()) )

    inputStream.print()
    //    logStream.addSink(new JDBCSink);

    env.execute("YC_ORDER_TEST : ")

  }
}
